
<html>
<head>
<meta http-equiv = "content-Type" content = "text/html" charset = "utf-8">
    <title>방문 요청 확인</title>
     
	 <style type="text/css">
        a{color:black; text-decoration:none; }
		a:link{color:green; text-decoration:none;}
        a:hover{color:black; text-decoration:none; }
        a:visited{color:green; text-decoration:none; }
        a:active{color:black; text-decoration:none; }
    </style>
    <script language="Javascript">
// 프레임셋 사용 새로고침 메인으로 가는거 방지
document.onkeydown = function() {
 if (event.keyCode == 116) {
 event.keyCode = 505;
 }

 if (event.keyCode == 505) {
  location.reload();
 return false;
 }
}
</script>
</head>
	<body>
	<center><h2>방문 요청 확인</h2>

	<form name='form' method='post' action='resultDB.php'>
	<table width=680 border=1 cellpadding=1>
	<tr>
	    <td witdh=20% align=center><B>Index</B></td>
        <td witdh=20% align=center><B>학부모 이름</B></td>
	    <td witdh=20% align=center><B>학부모 전화번호</B></td>
		<td witdh=20% align=center><B>방문 목적</B></td>
		<td witdh=20% align=center><B>방문 날짜</B></td>
		<td witdh=20% align=center><B>코드</B></td>
		<td witdh=20% align=center><B>상태</B></td>
				<td witdh=20% align=center><B>권한</B></td>
    </tr>
	
<?php>

$connect = mysql_connect("127.0.0.1", "root", "apmsetup"); //DB가 있는 주소(이것은 웹서버로 직접 접속하는 것이기 때문에 루프백 주소를 써인 됨)
if (!$connect) die("Unable to connect to MYSQL: " . mysql_error());

mysql_selectdb("lhu114") or die("Unable to select database : " . mysql_error()); //DB 선택

mysql_query("set names utf8"); //이것 또한 한글(utf8)을 지원하기 위한 것
mysql_query("set names euckr"); //이것 또한 한글(utf8)을 지원하기 위한 것
mysql_query("set session character_set_connection=utf8;");
mysql_query("set session character_set_results=utf8;");
mysql_query("set session character_set_client=utf8;");

$Id = $_REQUEST[Id]; //주소에 있는 name값을 받아 name 변수에 저장
 $apiKey = "AIzaSyC0xRoYyS_jR3uQ25h3_Sx4-WNfoWF8aW8";

$qry = "select * from visit_request where VisitDate = '$VisitDate';";
$result = mysql_query($qry);

$row_count=mysql_num_rows($result); // 레코드 개수
$fields_count=mysql_num_fields($result); //필드 개수

    for($a=0; $a < $row_count; $a++) 
	{
		$qry2 = "select KeyValue from visit_request where IndexValue = '$a'+1;";
		$result2 = mysql_query($qry2);

		while($obj = mysql_fetch_object($result2)){
			static $KeyValue;
			     $KeyValue = $obj->KeyValue;
		}

		echo "<tr>";
		for($b=0; $b < $fields_count; $b++) {
			$data=mysql_result($result, $a, $b);
			echo"<td><center> $data </center></td>";
		}
		
		echo $KeyValue;
		echo"<center><TD><a href='test.php?KeyValue=$KeyValue'>승인</a>";
		echo"<a href='test.php?KeyValue=$KeyValue'>|거절</a></TD>";
		echo"</center></tr>";
		  
		
	}
	echo " <hr><br><br>";
	

echo "
    </table></form><br><br><br>
    </center>
    <center>
";

 
?>

	<br><a href='result.html'>☞ 처음으로</a>
	</center>
    </body>
</html>